package RemoteServer;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;

import DataBase.DB_Factory;
import Po.Credits;
import Po.Discount;
import Po.Equivalent;
import Po.Manager;
import Po.Message;
import Po.Promotion;
import RemoteServerInterface.GeneralManagerServerInterface;

public class GeneralManagerServer  extends UnicastRemoteObject implements GeneralManagerServerInterface {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public GeneralManagerServer() throws RemoteException {}

	@Override
	public Manager GeneralManagerLogin(Manager m) {
		return DB_Factory.getManagerServerDB().GeneralManagerLogin(m);
	}

	@Override
	public Message presentPromotion(Promotion promotion, int rank, int num) {
		return DB_Factory.getPromotionServerDB().presentPromotion(promotion, rank, num);
	}

	@Override
	public int[] getRanks() {
		return DB_Factory.getCustomerServerDB().getRanks();
	}

	@Override
	public Message addDiscountPromotion(Discount promotion) {
		return DB_Factory.getPromotionServerDB().addDiscountPromotion(promotion);
	}

	@Override
	public Message addEquivalentPromotion(Equivalent promotion) {
		return DB_Factory.getPromotionServerDB().addEquivalentPromotion(promotion);
	}

	@Override
	public Message modeifyCredits(Credits c) {
		return DB_Factory.getPromotionServerDB().modifyCredits(c);
	}

	@Override
	public Message modifyDiscountPromotion(Discount p) {
		return DB_Factory.getPromotionServerDB().modifyDiscountPromotion(p);
	}

	@Override
	public Message modifyEquivalentPromotion(Equivalent p) {
		return DB_Factory.getPromotionServerDB().modifyEquivalentPromotion(p);
	}

	@Override
	public ArrayList<Promotion> getPromotions() throws RemoteException {
		return DB_Factory.getPromotionServerDB().getAllPromotionList();
	}

}
